You are here: Available Utilities > A > ARCRET > Using DAL to Select Records

Using DAL to Select Records

You can also include a DAL script to provide the final approval or rejection of a particular transaction. Note that the ARCRET utility processes all other parameters before it executes the DAL script.

The /DAL parameter names the DAL script you want to execute on each transaction. Before calling the script, the APPIDX record variables are converted into DAL variables using the standard DAL DB naming convention.

The DAL DB nomenclature associates all the row/record variable names with a table name. The table name is typically specified in the script or is the name of the table being referenced. Because DAL does not actually open the database and because there may be more than one index file, all record members are associated with the name ARCRET.

For instance, suppose your APPIDX has these members specified in the DFD file:

< Fields >

   FieldName = Key1

   FieldName = Key2

   FieldName = PolicyNum

   FieldName = RunDate

   FieldName = ArcKey

   FieldName = FormsetID

These fields would be referenced using the following names in any script associated with the ARCRET utility.

ArcRet.Key1

ArcRet.Key2

ArcRet.PolicyNum

ArcRet.RunDate

ArcRet.ArcKey

ArcRet.FormsetId

Note that since DAL only supports STRING, LONG, and DECIMAL data types, some variables may be converted to the closest matching type. When in doubt, assume the data will be of the STRING type for comparison purposes.

Since DAL has no knowledge of how a field will be used, always use the FORMAT and DEFORMAT functions where appropriate in your DAL scripts. For DFD members that hold DATE values, be sure to use the appropriate DATE functions, such as DATE2DATE, to convert values to a standard format before comparing them.

For example, if you want to select all transactions where the Key2 variable contains TEXAS, you would write a DAL script similar to this one:

IF ArcRet.Key2 = “TEXAS”

RETURN(“Yes”);

END

RETURN(“NO”);

Note The return value from the script is important. If the script returns Yes, that means to include the transaction in the set. Any other return value – including omitting a return value—excludes the transaction from the set. The case of the word Yes in the returned value is not important.

If you saved this script using the name MATCH.DAL, you would enter this command:

ARCRET /DAL=MATCH.DAL

For performance reasons, the utility normally pre-compiles your DAL scripts in memory before executing them. This makes each subsequent execution of the script faster than if the script was not pre-compiled. You can, however, turn off this behavior by including the /NC parameter. Typically, you would only include this parameter for debugging purposes.

You can also use the /DB parameter to debug scripts. This parameter produces lots of output, so be sure to send the console output to a file using the <“>filename” parameter on the command line. Also, use the /S parameter to limit the run to only a few transactions. Otherwise, the amount of output will be overwhelming.